package com.meida.module.bus.provider.handler;

import com.meida.common.base.entity.EntityMap;
import com.meida.common.mybatis.interceptor.GetInterceptor;
import com.meida.common.mybatis.query.CriteriaQuery;
import com.meida.module.system.client.entity.SysDictData;
import com.meida.module.user.client.entity.AppEducational;
import com.meida.module.user.client.entity.AppSchool;
import com.meida.module.user.client.entity.AppUser;
import org.springframework.stereotype.Component;

/**
 * 后台用户教育经历列表
 */
@Component
public class AppEducationalGetHandler implements GetInterceptor {

    @Override
    public void prepare(CriteriaQuery cq, EntityMap entityMap) {
        cq.clear();
        cq.select(AppEducational.class, "educationalId", "parentId", "schoolId", "educationId", "major", "state", "educationDate", "remark", "createTime");
        cq.select(AppUser.class, "userName");
        cq.select(AppSchool.class, "schoolLogo", "schoolName");
        cq.select(SysDictData.class, "dicDataTitle educationName");
        cq.eq(AppEducational.class, "state");
        cq.like(AppUser.class, "userName");
        cq.createJoin(AppUser.class).setMainField("userId").setJoinField("userId");
        cq.createJoin(AppSchool.class).setMainField("schoolId").setJoinField("schoolId");
        cq.createJoin(SysDictData.class).setMainField("educationId").setJoinField("dictDataId");
    }
}
